/**
 * Created by jiangtao on 2017/5/24.
 */

import React , { Component } from 'react'

import Loading from './Loading';

class Plus extends  Component {
    constructor(){
        super();
        this.state = {
            loading: false
        }
    }

    componentWillMount() {
        window.loading = ()=> {
            this.setState({
                loading:true
            });
        };
        window.loadingClose = () => {
            this.setState({
                loading:false
            });
        };
    }

    render(){
       const { children } = this.props;
       const { loading } = this.state;
       return(
          <div className="wrap-box">
              {/*所有全部组件都写在这里面*/}
              <div className="plus">
                  <Loading show={loading}/>
              </div>
              <div className="app-content">
                  {children}
              </div>
          </div>
       )
    }
}

export default  Plus;
